<%= content_for(:page_title) do %>
  <%= Spree.t(:payment_methods) %>
<% end %>

<% content_for :page_actions do %>
  <%= render_admin_partials(:payment_methods_actions_partials) %>
<% end %>

<%= render_admin_partials(:payment_methods_header_partials) %>

<div class="card-lg">
  <table class="table">
    <thead>
      <tr>
        <th scope="col"></th>
        <th scope="col"><%= Spree.t(:payment_method) %></th>
        <th scope="col"><%= Spree.t(:visibility) %></th>
        <th class="text-center"><%= Spree.t(:active) %></th>
        <th scope="col"></th>
      </tr>
    </thead>
    <tbody data-controller="sortable" data-sortable-handle-value=".move-handle" data-sortable-resource-name-value="payment_method" data-sortable-response-kind-value="turbo-stream">
      <%= render partial: 'spree/admin/payment_methods/payment_method', collection: @payment_methods %>
    </tbody>
  </table>
</div>

<% if available_payment_methods.present? && can?(:create, Spree::PaymentMethod) %>
  <h6 class="pb-2 pt-3">Available Payment Methods</h6>
  <div class="card-lg">
    <div class="table-responsive">
      <table class="table">
        <thead>
        <tr>
          <th scope="col"><%= Spree.t(:name) %></th>
          <th scope="col"><%= Spree.t(:description) %></th>
          <th scope="col"></th>
        </tr>
      </thead>
      <tbody>
        <%= render partial: 'spree/admin/payment_methods/available_payment_method', collection: available_payment_methods, as: :payment_method %>
      </tbody>
    </table>
  </div>
<% end %>

<p class="text-muted text-center my-5">
  Find more payment methods in <%= external_link_to 'Integrations Directory', 'https://spreecommerce.org/docs/integrations/integrations', class: 'text-decoration-none font-weight-bold', target: '_blank' %>
</p>